
//引入mockjs库
import Mock from 'mockjs'

//生成店铺列表数据
var shoplist = Mock.mock({
    "list|5": [
        {
            "id|+1": 1,
            "pic": '@image(100x100,@color)',
            "name": '@ctitle',
            "buyCount|100-10000": 1,
            "desc": '@ctitle(20)'
        }
    ]
})

//定义店铺接口
Mock.mock('/shoplist', 'get', function () {
    return shoplist;
})

//生成商品数据
var goodlist = Mock.mock({
    "list|5": [
        {
            "title|+1": ['三文鱼', '刺身', '年货区', '大虾', '冻货区'],
            "content|5": [
                {
                    "id|+1": 1,
                    "pic": '@image(100x100)',
                    "name": '@ctitle',
                    "buyCount|100-1000": 1,
                    "desc": '@ctitle(10)',
                    "price|10-100":1
                }
            ]
        }
    ]
})

//定义商品接口
Mock.mock('/goodlist', 'get', function () {
    return goodlist;
})